<template lang="html">
    <div class="box">
          <div class="header">
                <el-tabs v-model="activeName">
                  <el-tab-pane label="服务费" name="1"></el-tab-pane>
                </el-tabs>
          </div>

          <div class="body">
              <el-form class="filterCondition demo-form-inline" ref="form"  :inline="true" label-width="80px">
                  <el-input placeholder="技师姓名" v-model="keyword" style="width: 420px;">
                    <el-button slot="append" style="width: 120px;" @click="switchTab()">搜索</el-button>
                  </el-input>
                  <el-form-item label="时间段" style="margin-bottom: 0;width: 520px;">
                    <el-date-picker v-model="intervalTime" type="daterange" align="right" unlink-panels range-separator="-"
                      start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;"
                      value-format="yyyy-MM-dd HH:mm:ss" >
                    </el-date-picker>
                  </el-form-item>
              </el-form>
              <div class="table_box">
                  <el-table :data="tableData.list" style="width: 100%">
                      <el-table-column  prop="worker_name"  align="center" label="技师姓名" >
                        <!-- <template lang="html" slot-scope="scope">
                            <el-popover trigger="hover" placement="top">
                                <p>姓名: {{ scope.row.share_name }}</p>
                                <div slot="reference" class="name-wrapper">
                                  <el-tag size="medium">{{ scope.row.share_name }}</el-tag>
                                </div>
                            </el-popover>
                        </template> -->
                      </el-table-column>
                      <el-table-column  prop="company"  align="center" label="维修厂名称" >
                        <!-- <template lang="html" slot-scope="scope">
                            <el-popover trigger="hover" placement="top">
                                <p>姓名: {{ scope.row.share_name }}</p>
                                <div slot="reference" class="name-wrapper">
                                  <el-tag size="medium">{{ scope.row.share_name }}</el-tag>
                                </div>
                            </el-popover>
                        </template> -->
                      </el-table-column>
                      <el-table-column  prop="refund_price"  align="center" label="金额" ></el-table-column>
                      <el-table-column  prop="user_name"  align="center" label="车主姓名" >
                        <!-- <template lang="html" slot-scope="scope">
                            <el-popover trigger="hover" placement="top">
                                <p>姓名: {{ scope.row.share_name }}</p>
                                <div slot="reference" class="name-wrapper">
                                  <el-tag size="medium">{{ scope.row.share_name }}</el-tag>
                                </div>
                            </el-popover>
                        </template> -->
                      </el-table-column>
                      <el-table-column  prop="card_price"  align="center" label="购卡金额" ></el-table-column>
                      <el-table-column  prop="car_type"  align="center" label="车型" >
                        <template lang="html" slot-scope="scope">
                            <el-popover trigger="hover" placement="top">
                                <p>{{ scope.row.car_brand }}-{{ scope.row.car_type }}</p>
                                <div slot="reference" class="name-wrapper">
                                  <el-tag size="medium">{{ scope.row.car_type }}</el-tag>
                                </div>
                            </el-popover>
                        </template>
                      </el-table-column>
                      <el-table-column  prop="create_time"  align="center" label="时间" ></el-table-column>
                  </el-table>
              </div>
              <p  class="summary">{{tableData.total}}</p>
              <!--  -->
              <div class="page_box">
                  <el-pagination class="page" layout="prev, pager, next"
                  :current-page="currentPage"
                    @current-change="switchPage" :page-count='tableData.rows' >
                  </el-pagination>
              </div>
          </div>

    </div>
</template>

<script>
export default {
  data() {
      return {
        token: this.$store.state.user.token3,
        activeName: '1',
        keyword: '',
        tableData: [],
        currentPage:1,
        intervalTime: [],
      }
  },
  created(){
    this.switchTab()
  },
  methods:{
    switchTab(p=1){
      var jsonData = {
        token: this.token,
        key: this.keyword,
        start_time: (this.intervalTime && this.intervalTime[0]) || '',
        end_time: (this.intervalTime && this.intervalTime[1]) || '',
        page: p
      }
      this.currentPage = p;
      this.$http3.workerServiceList(jsonData).then(this.resultFn())
    },
    resultFn(){
      return function(res) {
          if(res){
            this.tableData =
            res.data.code ===1 ?
            this.tableData = res.data.data:[];
          }
      }.bind(this)
    },

    switchPage(e){
        this.switchTab(this.activeName,e)
    }
  }
}
</script>

<style lang="css" scoped>
@import "../../../my-style/app.css";
/deep/ .el-input-group__append, .el-input-group__prepend{
  background-color: #3498E9;
  border: none;
  color: white;
}
.page_box{
  text-align: center;
}
</style>
